import React from "react";
import {Animated, Keyboard} from 'react-native';
const KeyboardHeightView = () => {
    const [keyboardHeight, setKeyboardHeight] = React.useState(new Animated.Value(0));
    React.useEffect(() => {
        Keyboard.addListener('keyboardWillShow', (e) => {
            //setKeyboardHeight(new Animated.Value(e.endCoordinates.height));
            Animated.timing(keyboardHeight, {
                toValue: e.endCoordinates.height,
                duration: e.duration,
                useNativeDriver: false
            }).start();
        });
        Keyboard.addListener('keyboardWillHide', (e) => {
            //setKeyboardHeight(new Animated.Value(0));
            Animated.timing(keyboardHeight, {
                toValue: 0,
                duration: e.duration,
                useNativeDriver: false
            }).start();
        });
    }, []);
    return (
        <Animated.View style={{
            height: keyboardHeight
        }}></Animated.View>
    );
};

export default KeyboardHeightView;
